﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Legend.Component.Interface;
using Microsoft.Xna.Framework.Content;
using Legend.Object;
using Legend.Component.Common;

namespace Legend.Component.Bullet
{
    public class Movement : LinearMovement
    {
        private Quaternion rotateQuaternion = Quaternion.Identity;
        private int timeout;
        private double createdTime = 0;

        public int Timeout
        {
            get { return timeout; }
            set { timeout = value; }
        }

        public Movement()
        {
            timeout = 0;
        }

        public override void Update(GameTime gameTime, ContentManager contentManager)
        {
            if (createdTime == 0)
            {
                createdTime = gameTime.TotalGameTime.TotalMilliseconds;
            }
            else if (timeout != 0 && createdTime + timeout < gameTime.TotalGameTime.TotalMilliseconds)
            {
                GameObjectManager.SetBoardValue("Combo", 0);
                GameObjectManager.UnregistGameObject(Owner);
            }
            else
            {
                base.Update(gameTime, contentManager);
            }
        }
    }
}
